"use strict";

module.exports = {
  // 在执行数据库升级时调用的函数，创建 t_version_packages 表
  up: async (queryInterface, Sequelize) => {
    const { INTEGER, BLOB, CHAR, DATE, STRING, UUID, UUIDV4 } = Sequelize;
    await queryInterface.createTable("t_version_package", {
      version_id: {
        type: UUID,
        primaryKey: true,
        allowNull: false
      },
      id: {
        type: UUID,
        primaryKey: true,
        allowNull: false,
        defaultValue: UUIDV4
      },
      package_name: { type: STRING(50), allowNull: false },
      status: { type: CHAR(3), allowNull: true, defaultValue: "000" },
      next_status: { type: CHAR(3), allowNull: true, defaultValue: "000" },
      src: { type: STRING(255), allowNull: true },
      remark: { type: STRING(255), allowNull: true },
      refuse_reason: { type: STRING(255), allowNull: true },
      create_user_id: { type: UUID, allowNull: true },
      modify_user_id: { type: UUID, allowNull: true },
      create_time: { type: DATE, allowNull: false },
      modify_time: { type:DATE, allowNull: false }
    });
  },
  // 在执行数据库降级时调用的函数，删除 t_version_packages 表
  down: async queryInterface => {
    await queryInterface.dropTable("t_version_package");
  }
};
